#include <stdio.h>
#include <string.h>

int main() {
	char s[1001] = {0};
	scanf("%s", s);
	int len = strlen(s);
	if (s[len - 1] == 's' && len > 1)
		s[--len] = '\0';
	else if (((s[len - 1] == 'r' && s[len - 2] == 'e') || (s[len - 1] == 'y' && s[len - 2] == 'l') || (s[len - 1] == 'd'
	          && s[len - 2] == 'e')) && (len > 2)) {
		s[--len] = '\0';
		s[--len] = '\0';
	} else if ((s[len - 1] == 'g' && s[len - 2] == 'n' && s[len - 3] == 'i') && (len > 3)) {
		s[--len] = '\0';
		s[--len] = '\0';
		s[--len] = '\0';
	}
	char *pa = &s[0];
	char *pb = &s[len - 1];
	while (*pa == *pb) {
		pa++;
		pb--;
		if (pa >= pb)
			break;
	}
	if (pa >= pb) {
		printf("%s\n", s);
		printf("Yes");
	} else {
		printf("%s\n", s);
		printf("No");
	}
}